package com.stu.service.impl;

import com.stu.mapper.RoleMapper;
import com.stu.mapper.UserMapper;
import com.stu.pojo.Permission;
import com.stu.pojo.Role;
import com.stu.service.RoleAndPermManageService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class RoleAndPermManageServiceImpl implements RoleAndPermManageService {
    @Resource
    private UserMapper userMapper;
    @Resource
    private RoleMapper roleMapper;

    @Override
    public List<Role> getRolesByUname(String username) {
        return userMapper.selectRolesByUsername(username);
    }

    @Override
    public List<Permission> getPermsByRname(String rolename) {
        return roleMapper.selectPermissionsByRoleName(rolename);
    }
}
